package com.hyphenate.easeui.ui;


import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

import com.hyphenate.easeui.R;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;

/**
 * Created by shifei on 2018/9/29.
 * 视频播放器
 */

public class VideoPlayerActivity extends EaseBaseActivity {


    private JzvdStd detail_player;
    private String localPath;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.ease_acitivity_video_player);

        localPath = getIntent().getStringExtra("localPath");

        detail_player = (JzvdStd)findViewById(R.id.detail_player);
        detail_player.setUp(localPath, "", Jzvd.SCREEN_WINDOW_NORMAL);
        //增加封面
        detail_player.startButton.performClick();
        detail_player.startVideo();
    }

    @Override
    public void onBackPressed() {
        if (detail_player.backPress()) {
            return;
        }
        super.onBackPressed();
    }

    @Override
    protected void onPause() {
        super.onPause();
        detail_player.releaseAllVideos();
    }
}
